package cn.vcjf.weapp.api.active.entity;

import cn.vcjf.weapp.common.TableAlias;
import cn.vcjf.weapp.common.util.ThreadContextHolder;
import cn.vcjf.weapp.common.web.JsonDateTypeConvert;
import cn.vcjf.weapp.common.web.PageModel;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
    * 
    * </p>
 *
 * @author zhengzihang
 * @since 2018-09-26
 */
@TableName("vc_goods_active")
public class GoodsActive extends PageModel<GoodsActive> {

    private static final long serialVersionUID = 1L;

    @TableAlias("ga")
    private Integer sysUserId;

    @TableId(value = "id", type = IdType.AUTO)
    @TableAlias("ga")
    private Integer id;

    /**
     * 商品规格ID（确定是哪种商品或套餐）
     */
    @TableAlias("ga")
    private Integer goodsGroupId;

    /**
     * 活动类型(1拼团,2砍价)
     */
    @TableAlias("ga")
    @NotNull
    private Integer activetype;

    /**
     * 原价
     */
    @TableAlias("ga")
    private BigDecimal costPrice;

    /**
     * 活动价
     */
    @TableAlias("ga")
    private BigDecimal activePrice;

    /**
     * 可砍价格
     */
    @TableAlias("ga")
    private BigDecimal bargainPrice;

    /**
     * 最低金额
     */
    @TableAlias("ga")
    private BigDecimal minPrice;

    /**
     * 活动开始时间(拼团)
     */
    @TableAlias("ga")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date activeStarTime;

    /**
     * 活动结束时间(拼团)
     */
    @TableAlias("ga")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date activeEndTime;

    /**
     * 活动时间(砍价有效时间,单位分钟)
     */
    @TableAlias("ga")
    private Integer activeTime;

    /**
     * 规定参与人数
     */
    @TableAlias("ga")
    private Integer collageNum;

    /**
     * 状态(1,开启.2,关闭)
     */
    @TableAlias("ga")
    private Integer status;
	/**
	 * 排序
	 */
	@TableAlias("ga")
    private Integer sortNo;
    /**
     * 活动名称
     */
    @TableAlias("ga")
    private String activeName;
    /**
     * 活动描述
     */
    @TableAlias("ga")
    private String activeDes;

/*****************************************************/
    /**
     * 商品名称
     */
    @TableField(exist=false)
    @TableAlias("gi")
    private String goodsName;

    /**
     * 商品描述
     */
    @TableField(exist=false)
    @TableAlias("gi")
    private String goodsDes;
    /**
     * 商品图片
     */
    @TableField(exist=false)
    @TableAlias("gi")
    private String goodsFilesId;

    /**
     * 活动参与次数
     */
    @TableField(exist=false)
    @TableAlias("gi")
    private Integer joinCount;

    public GoodsActive(){
        this.sysUserId = ThreadContextHolder.getSysUserId();
    }
    public Integer getJoinCount() {
        return joinCount;
    }

    public void setJoinCount(Integer joinCount) {
        this.joinCount = joinCount;
    }

    public Integer getSortNo() {
		return sortNo;
	}

	public void setSortNo(Integer sortNo) {
		this.sortNo = sortNo;
	}

	public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getGoodsDes() {
        return goodsDes;
    }

    public void setGoodsDes(String goodsDes) {
        this.goodsDes = goodsDes;
    }

    public String getGoodsFilesId() {
        return goodsFilesId;
    }

    public void setGoodsFilesId(String goodsFilesId) {
        this.goodsFilesId = goodsFilesId;
    }

    public String getActiveName() {
        return activeName;
    }

    public void setActiveName(String activeName) {
        this.activeName = activeName;
    }

    public String getActiveDes() {
        return activeDes;
    }

    public void setActiveDes(String activeDes) {
        this.activeDes = activeDes;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getGoodsGroupId() {
        return goodsGroupId;
    }

    public void setGoodsGroupId(Integer goodsGroupId) {
        this.goodsGroupId = goodsGroupId;
    }
    public Integer getActivetype() {
        return activetype;
    }

    public void setActivetype(Integer activetype) {
        this.activetype = activetype;
    }
    public BigDecimal getCostPrice() {
        return costPrice;
    }

    public void setCostPrice(BigDecimal costPrice) {
        this.costPrice = costPrice;
    }
    public BigDecimal getActivePrice() {
        return activePrice;
    }

    public void setActivePrice(BigDecimal activePrice) {
        this.activePrice = activePrice;
    }
    public BigDecimal getBargainPrice() {
        return bargainPrice;
    }

    public void setBargainPrice(BigDecimal bargainPrice) {
        this.bargainPrice = bargainPrice;
    }
    public BigDecimal getMinPrice() {
        return minPrice;
    }

    public void setMinPrice(BigDecimal minPrice) {
        this.minPrice = minPrice;
    }
    @JsonSerialize(using= JsonDateTypeConvert.class)
    public Date getActiveStarTime() {
        return activeStarTime;
    }

    public void setActiveStarTime(Date activeStarTime) {
        this.activeStarTime = activeStarTime;
    }
    @JsonSerialize(using= JsonDateTypeConvert.class)
    public Date getActiveEndTime() {
        return activeEndTime;
    }

    public void setActiveEndTime(Date activeEndTime) {
        this.activeEndTime = activeEndTime;
    }
    public Integer getActiveTime() {
        return activeTime;
    }

    public void setActiveTime(Integer activeTime) {
        this.activeTime = activeTime;
    }
    public Integer getCollageNum() {
        return collageNum;
    }

    public void setCollageNum(Integer collageNum) {
        this.collageNum = collageNum;
    }
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public Integer getSysUserId() {
        return sysUserId;
    }

    @Override
    public void setSysUserId(Integer sysUserId) {
        this.sysUserId = sysUserId;
    }

    @Override
    public void preInsert(){
        super.preInsert();
    }
    @Override
    public void preUpdate(){
        super.preInsert();
    }
    @Override
    public String toString() {
        return "GoodsActive{" +
        "id=" + id +
        ", goodsGroupId=" + goodsGroupId +
        ", activetype=" + activetype +
        ", costPrice=" + costPrice +
        ", activePrice=" + activePrice +
        ", bargainPrice=" + bargainPrice +
        ", minPrice=" + minPrice +
        ", activeStarTime=" + activeStarTime +
        ", activeEndTime=" + activeEndTime +
        ", activeTime=" + activeTime +
        ", collageNum=" + collageNum +
        ", status=" + status +
        ", createUser=" + createUser +
        ", createTime=" + createTime +
        ", updateUser=" + updateUser +
        ", updateTime=" + updateTime +
        ", deleteFlag=" + deleteFlag +
        ", sysUserId=" + sysUserId +
        "}";
    }
}
